//
//  JsonView.h
//  BandApp
//
//  Created by Alec Flett on 8/13/09.
//  Copyright 2009 __MyCompanyName__. All rights reserved.
//

#import <UIKit/UIKit.h>

#import "Freebase.h"
#import "FreebaseCollection.h"

@interface FreebaseTable : UITableViewController <UITableViewDataSource, UITableViewDelegate, FreebaseCollectionDelegate> {
    NSString *_titleKey;
    NSString *_subtitleKey;
    NSString *_sortKey;
    
    FreebaseCollection* _collection;
    
    // maps a section index -> a row within the data
    NSMutableArray* _sectionRows;
    NSMutableArray* _sectionTitles;
    NSInteger _totalRows;
}

- (void)reload;
- (void)resetSections;


// you can/should override any of these to provide view-specific behavior
- (NSString *)titleForItem:(NSDictionary*)item;
- (NSString *)subtitleForItem:(NSDictionary*)item;
- (NSString *)sectionTitleForItem:(NSDictionary*)item;
- (id)imageIdForObject:(NSDictionary*)item;

- (id)itemAtIndexPath:(NSIndexPath*)indexPath;

@property(retain, nonatomic) NSString *subtitleKey;
@property(retain, nonatomic) NSString *titleKey;
@property(retain, nonatomic) NSString *sortKey;

@end
